package tech.aistar.corejava.day10;

import java.util.Date;

/**
 * Created by 李雨昂 on 2019/7/26.
 */
public class DateMethodDemo {
    public static void main(String[] args) {
        Date d = new Date();
        System.out.println(d);

        //通过setter来对Date重新设置值

        //设置年份
        d.setYear(2019-1900);

        d.setMonth(6);

        //设置日
        d.setDate(26);

        //获取今天是周几
        //如果是礼拜日 - week - 0
        int week = d.getDay();
        System.out.println("week:"+week);//5

        //获取年份
        int year = d.getYear()+1900;

        System.out.println("year:"+year);

        System.out.println(d);

    }
}
